#include <stdio.h>
#include <math.h>
#include <stdlib.h>
char *m[7] = {"", "US", " UK", "FRANCE", "GER", "ITALY", "EUSSIAN"};
int main()
{
    int a[7][7], i, j, k, n, t, e, x, y;
    char b;
    for (i = 0; i < 7; i++)
        for (j = 0; j < 7; j++)
            a[i][j] = j;
    for (i = 1; i < 7; i++)
        a[0][i] = 1;
    a[1][1] = a[2][1] = a[3][1] = a[5][1] = 0;
    a[1][3] = a[2][3] = a[3][3] = 0;
    a[1][4] = a[2][4] = a[3][4] = a[5][4] = a[6][4] = 0;
    a[3][5] = 0;
    a[1][6] = a[3][6] = a[5][6] = 0;
    while (a[0][1] + a[0][2] + a[0][3] + a[0][4] + a[0][5] + a[0][6] > 0)
    {
        for (i = 1; i < 7; i++)
            if (a[0][i])
            {
                for (e = 0, j = 1; j < 7; j++)
                    if (a[j][i])
                    {
                        x = j;
                        y = i;
                        e++;
                    }
                if (t != i)
                    a[x][t] = 0;
                a[0][y] = 0;
            }
    }
}
for (i = 1; i < 7; i++)
{
    printf("%c is comeing from ", 'A' - 1 + i);
    for (j = 1; j < 7; j++)
        if (a[i][j] != 0)
        {
            printf("%s\n", m[a[i][j]]);
            break;
        }
}